import {
    Entity,
    Column,
    PrimaryGeneratedColumn,
    ManyToMany,
    CreateDateColumn,
    UpdateDateColumn
} from 'typeorm';

@Entity()
export class File {
    @PrimaryGeneratedColumn()
    id: number

    @Column({ type: 'text', default: null, charset: 'utf8mb4', select: true })
    fileName: string;

    @Column({ type: 'text', default: null, charset: 'utf8mb4', select: false })
    desc: string;

    @Column('enum', {
        enum: [1001, 1002, 1003],
        select: true,
        default: 1001 // 图片类型 1001， 文章， 1002, 照片墙， 1003 ，壁纸
    })
    type: number; // 图片类型

    @CreateDateColumn({
        type: 'datetime',
        comment: '创建时间',
        name: 'create_time'
    })
    createTime: Date;

    @UpdateDateColumn({
        type: 'datetime',
        comment: '更新时间',
        name: 'update_time'
    })
    updateTime: Date;
}